package com.agent.user.service;

import com.agent.common.utils.IdGenerator;
import com.agent.user.entity.AdminOperationLog;
import com.agent.user.mapper.AdminOperationLogMapper;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.time.ZoneOffset;

@Service
@RequiredArgsConstructor
public class AdminOperationLogService {
    private final AdminOperationLogMapper logMapper;
    private final IdGenerator idGenerator = IdGenerator.getInstance();

    public void recordOperation(AdminOperationLog log) {
        log.setId(idGenerator.nextId());
        log.setCreatedAt(LocalDateTime.now(ZoneOffset.UTC));
        logMapper.insert(log);
    }
}